package com.cxy.pattern;

public class DCL {

    private static DCL dcl;

    private DCL() {
    }

    public static DCL getInstance() {
        if (dcl == null) {
            synchronized (DCL.class) {
                System.out.println(Thread.currentThread().getName()+"第一层锁");
                if (dcl == null) {
                    System.out.println(Thread.currentThread().getName()+"第二层锁");
                    dcl = new DCL();
                }
                dcl = new DCL();
            }
        }
        return dcl;
    }
}
